<template></template>

<script>
import { Toast } from 'vant';
import auth from '../../utils/auth';

export default {
  mounted() {
    if (
      typeof (this.$route.query.token) === 'undefined' ||
      this.$route.query.token === null ||
      this.$route.query.token === ''
    ) {
      Toast('Token 不存在');
      return false;
    }

    auth.removeToken();
    auth.setToken(this.$route.query.token);

    Toast('正在进入...');
    setTimeout(() => {
      Toast.clear();
      this.$router.push({ name: 'user' });
    }, 1000);
  }
};

</script>
